﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kaiser.Repositories;

namespace Kaiser.Services.Impl
{
    public class UserGroupService : IUserGroupService
    {
        private readonly IRepository _repository;

        public UserGroupService(IRepository repository)
        {
            _repository = repository;//
        }

        public Models.UserGroup GetItem(Guid userGroupID)
        {
            try
            {
                return _repository.GetUserGroupItem(userGroupID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public Models.UserGroup GetItem(string userGroupName)
        {
            try
            {
                return _repository.GetUserGroupItem(userGroupName);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public List<Models.UserGroup> GetList(Guid? parentID = null)
        {
            try
            {
                return _repository.GetUserGroupList(parentID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public Models.ModelResult Save(Xoohoo.Models.InputModels.UserGroupInput userGroupInput)
        {
            try
            {
                return _repository.Save(userGroupInput);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public bool Remove(Guid userGroupID)
        {
            try
            {
                return _repository.Remove(userGroupID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #region IUserGroupService 成员

        public Models.UserGroup GetUserGroupItem(Guid userGroupID)
        {
            throw new NotImplementedException();
        }

        public Models.UserGroup GetUserGroupItem(string userGroupName)
        {
            throw new NotImplementedException();
        }

        public List<Models.UserGroup> GetUserGroupList(Guid? parentID = null)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
